package org.groupg.practice.text;

import org.apache.commons.text.similarity.JaccardDistance;
import org.apache.commons.text.similarity.JaccardSimilarity;
import org.apache.commons.text.similarity.JaroWinklerDistance;
import org.apache.commons.text.similarity.JaroWinklerSimilarity;

public class JaroWinklerSimilarityDemo {
    public static void main(String[] args) {

        String left = "李庚谱123LIGENGPU";
        String right = "李庚谱123LIGENGPU1234";

        // 看两个字符串的相似度
        JaroWinklerSimilarity sim = new JaroWinklerSimilarity();
        // 看两个字符串差距有多远
        JaroWinklerDistance dis = new JaroWinklerDistance();
        // 看两个字符串之间 Jaccard 相似性多少
        JaccardSimilarity jcs = new JaccardSimilarity();
        // 看两个字符串之间 Jaccard 差距多少
        JaccardDistance jcd = new JaccardDistance();


        System.out.println(sim.apply(left,right));
        System.out.println(dis.apply(left,right));
        System.out.println(jcs.apply(left,right));
        System.out.println(jcd.apply(left,right));

    }
}
